import yaml

from logger_config import logging

logger = logging.getLogger(__name__)


def load_config(config_path):
    """
    Load YAML configuration file.

    Parameters:
        config_path (str): Path to the YAML configuration file.

    Returns:
        dict: Configuration data.
    """
    try:
        with open(config_path, 'r', encoding='utf-8') as file:
            return yaml.safe_load(file)
    except Exception as e:
        logger.error(f"Failed to load config: {e}")
        raise